<!DOCTYPE html>
<html lang="en" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>v-model指令</title>
</head>
<body>
<!-- 2.挂载的html结构 -->
<div id="app">
    <!--增加绑定-->
    <input type="button" value="修改message" @click="setM">
    <input type="text" v-model="message" @keyup.enter="getM">
    <h2>{{ message }}</h2>
</div>
<!-- 1.开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    //  3.创建Vue实例
    var app = new Vue({
        el:"#app",//el:挂载点 id选择器
        data:{
            message:"EnjoyToShare"
        },
        //操作数据变更
        methods:{
            getM:function () {
                alert(this.message);
            },
            setM:function () {
                this.message = "wugenqiang";
            }
        }
    })
</script>
</body>
</html>
